package com.engine4cloud.tdf.supervision.convert;

import com.engine4cloud.tdf.common.core.constant.enums.NormalAuditActionStatusEnum;
import com.engine4cloud.tdf.common.core.util.CodeUtils;
import com.engine4cloud.tdf.supervision.dto.create.SpPrisonExecuteCreateDTO;
import com.engine4cloud.tdf.supervision.dto.result.SpPrisonExecuteResultDTO;
import com.engine4cloud.tdf.supervision.dto.update.SpPrisonExecuteUpdateDTO;
import com.engine4cloud.tdf.supervision.entity.SpPrisonExecuteEntity;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

@Mapper
public interface SpPrisonExecuteConvert {
    SpPrisonExecuteConvert INSTANCE = Mappers.getMapper(SpPrisonExecuteConvert.class);

    SpPrisonExecuteResultDTO convert(SpPrisonExecuteEntity s);

    SpPrisonExecuteEntity create(SpPrisonExecuteCreateDTO s);

    SpPrisonExecuteEntity update(SpPrisonExecuteUpdateDTO s);

    default SpPrisonExecuteEntity create(SpPrisonExecuteCreateDTO s, Long tenantId, NormalAuditActionStatusEnum action) {
        SpPrisonExecuteEntity entity = create(s);
        entity.setTenantId(tenantId);
        entity.setPreAction(action);
        entity.setLcbh(CodeUtils.entrustCode());
        return entity;
    }
}
